home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / gnome-vfs-2.0 / libgnomevfs / gnome-vfs-async-ops.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-05-01  |  20.6 KB  |  461 lines

  1. /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
  2.  
  3. /* gnome-vfs-async-ops.h - Asynchronous operations in the GNOME Virtual File
  4.    System.
  5.  
  6.    Copyright (C) 1999 Free Software Foundation
  7.  
  8.    The Gnome Library is free software; you can redistribute it and/or
  9.    modify it under the terms of the GNU Library General Public License as
  10.    published by the Free Software Foundation; either version 2 of the
  11.    License, or (at your option) any later version.
  12.  
  13.    The Gnome Library is distributed in the hope that it will be useful,
  14.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the GNU
  16.    Library General Public License for more details.
  17.  
  18.    You should have received a copy of the GNU Library General Public
  19.    License along with the Gnome Library; see the file COPYING.LIB.  If not,
  20.    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  21.    Boston, MA 02111-1307, USA.
  22.  
  23.    Author: Ettore Perazzoli <ettore@comm2000.it> */
  24.  
  25. #ifndef GNOME_VFS_ASYNC_OPS_H
  26. #define GNOME_VFS_ASYNC_OPS_H
  27.  
  28. #include <glib/giochannel.h>
  29. #include <libgnomevfs/gnome-vfs-file-info.h>
  30. #include <libgnomevfs/gnome-vfs-find-directory.h>
  31. #include <libgnomevfs/gnome-vfs-handle.h>
  32. #include <libgnomevfs/gnome-vfs-xfer.h>
  33.  
  34. G_BEGIN_DECLS
  35.  
  36. /**
  37.  * GNOME_VFS_PRIORITY_MIN: 
  38.  *
  39.  * The minimuum priority a job can have.
  40.  **/
  41. /**
  42.  * GNOME_VFS_PRIORITY_MAX: 
  43.  *
  44.  * The maximuum priority a job can have.
  45.  **/
  46. /**
  47.  * GNOME_VFS_PRIORITY_DEFAULT:
  48.  *
  49.  * The default job priority. Its best to use this
  50.  * unless you have a reason to do otherwise.
  51.  **/
  52.  
  53. #define GNOME_VFS_PRIORITY_MIN     -10
  54. #define GNOME_VFS_PRIORITY_MAX     10
  55. #define GNOME_VFS_PRIORITY_DEFAULT 0
  56.  
  57. typedef struct GnomeVFSAsyncHandle GnomeVFSAsyncHandle;
  58.  
  59. /**
  60.  * GnomeVFSAsyncCallback:
  61.  * @handle: handle of the operation generating the callback
  62.  * @result: %GNOME_VFS_OK if the operation was successful, otherwise
  63.  * an error code.
  64.  * @callback_data: user data defined when the callback was established
  65.  *
  66.  * Basic callback from an async operation that passes no data back,
  67.  * informing the user of the @result of the operation.
  68.  **/
  69. typedef void    (* GnomeVFSAsyncCallback)    (GnomeVFSAsyncHandle *handle,
  70.                          GnomeVFSResult result,
  71.                          gpointer callback_data);
  72.  
  73. /**
  74.  * GnomeVFSAsyncOpenCallback:
  75.  * @handle: handle of the operation generating the callback
  76.  * @result: %GNOME_VFS_OK if the operation was successful, otherwise
  77.  * an error code.
  78.  * @callback_data: user data defined when the callback was established
  79.  *
  80.  * Basic callback from an async operation that passes no data back,
  81.  * informing the user of the @result of the operation.
  82.  **/
  83. typedef GnomeVFSAsyncCallback GnomeVFSAsyncOpenCallback;
  84.  
  85. /**
  86.  * GnomeVFSAsyncCreateCallback:
  87.  * @handle: handle of the operation generating the callback
  88.  * @result: %GNOME_VFS_OK if the operation was successful, otherwise
  89.  * an error code.
  90.  * @callback_data: user data defined when the callback was established
  91.  *
  92.  * Basic callback from an async operation that passes no data back,
  93.  * informing the user of the @result of the operation.
  94.  **/
  95. typedef GnomeVFSAsyncCallback GnomeVFSAsyncCreateCallback;
  96.  
  97. /**
  98.  * GnomeVFSAsyncCloseCallback:
  99.  * @handle: handle of the operation generating the callback
  100.  * @result: %GNOME_VFS_OK if the operation was successful, otherwise
  101.  * an error code.
  102.  * @callback_data: user data defined when the callback was established
  103.  *
  104.  * Basic callback from an async operation that passes no data back,
  105.  * informing the user of the @result of the operation.
  106.  **/
  107. typedef GnomeVFSAsyncCallback GnomeVFSAsyncCloseCallback;
  108.  
  109. #ifndef GNOME_VFS_DISABLE_DEPRECATED
  110. /**
  111.  * GnomeVFSAsyncOpenAsChannelCallback:
  112.  * @handle: handle of the operation generating the callback
  113.  * @channel: a #GIOChannel corresponding to the file opened
  114.  * @result: %GNOME_VFS_OK if the operation was successful, otherwise
  115.  * an error code.
  116.  * @callback_data: user data defined when the callback was established
  117.  *
  118.  * Callback for the gnome_vfs_async_open_as_channel() function.
  119.  **/
  120. typedef void    (* GnomeVFSAsyncOpenAsChannelCallback)
  121.                         (GnomeVFSAsyncHandle *handle,
  122.                          GIOChannel *channel,
  123.                          GnomeVFSResult result,
  124.                          gpointer callback_data);
  125. #endif
  126.  
  127. #ifndef GNOME_VFS_DISABLE_DEPRECATED
  128. /**
  129.  * GnomeVFSAsyncCreateAsChannelCallback:
  130.  * @handle: handle of the operation generating the callback
  131.  * @channel: a #GIOChannel corresponding to the file created
  132.  * @result: %GNOME_VFS_OK if the operation was successful, otherwise
  133.  * an error code.
  134.  * @callback_data: user data defined when the callback was established
  135.  *
  136.  * Callback for the gnome_vfs_async_create_as_channel() function.
  137.  **/
  138. typedef GnomeVFSAsyncOpenAsChannelCallback GnomeVFSAsyncCreateAsChannelCallback;
  139. #endif
  140.  
  141. /**
  142.  * GnomeVFSAsyncReadCallback:
  143.  * @handle: handle of the operation generating the callback
  144.  * @result: %GNOME_VFS_OK if the operation was successful, otherwise
  145.  * an error code.
  146.  * @buffer: buffer containing data read from @handle.
  147.  * @bytes_requested: the number of bytes asked for in the call to
  148.  * gnome_vfs_async_read().
  149.  * @bytes_read: the number of bytes actually read from @handle into @buffer.
  150.  * @callback_data: user data defined when the callback was established
  151.  *
  152.  * Callback for the gnome_vfs_async_read() function.
  153.  **/
  154. typedef void    (* GnomeVFSAsyncReadCallback)    (GnomeVFSAsyncHandle *handle,
  155.                          GnomeVFSResult result,
  156.                          gpointer buffer,
  157.                          GnomeVFSFileSize bytes_requested,
  158.                          GnomeVFSFileSize bytes_read,
  159.                          gpointer callback_data);
  160.  
  161. /**
  162.  * GnomeVFSAsyncWriteCallback:
  163.  * @handle: handle of the operation generating the callback
  164.  * @result: %GNOME_VFS_OK if the operation was successful, otherwise
  165.  * an error code.
  166.  * @buffer: buffer containing data written to @handle.
  167.  * @bytes_requested: the number of bytes asked to write in the call to
  168.  * gnome_vfs_async_write().
  169.  * @bytes_written: the number of bytes actually written to @handle from @buffer.
  170.  * @callback_data: user data defined when the callback was established
  171.  *
  172.  * Callback for the gnome_vfs_async_write() function.
  173.  **/
  174. typedef void    (* GnomeVFSAsyncWriteCallback)    (GnomeVFSAsyncHandle *handle,
  175.                          GnomeVFSResult result,
  176.                          gconstpointer buffer,
  177.                          GnomeVFSFileSize bytes_requested,
  178.                          GnomeVFSFileSize bytes_written,
  179.                          gpointer callback_data);
  180.  
  181.  
  182. /**
  183.  * GnomeVFSAsyncSeekCallback:
  184.  * @handle: handle of the operation generating the callback
  185.  * @result: %GNOME_VFS_OK if the operation was successful, otherwise
  186.  * an error code.
  187.  * @callback_data: user data defined when the callback was established
  188.  *
  189.  * Basic callback from an async operation that passes no data back,
  190.  * informing the user of the @result of the operation.
  191.  **/
  192. typedef GnomeVFSAsyncCallback GnomeVFSAsyncSeekCallback;
  193.  
  194.  
  195. /**
  196.  * GnomeVFSAsyncGetFileInfoCallback:
  197.  * @handle: handle of the operation generating the callback
  198.  * @results: #GList of #GnomeVFSFileInfoResult * items representing
  199.  * the success of each gnome_vfs_get_file_info() and the data retrieved.
  200.  * @callback_data: user data defined when the callback was established
  201.  *
  202.  * Callback for the gnome_vfs_async_get_file_info() function.
  203.  **/
  204. typedef void    (* GnomeVFSAsyncGetFileInfoCallback)
  205.                                                 (GnomeVFSAsyncHandle *handle,
  206.                          GList *results, /* GnomeVFSGetFileInfoResult* items */
  207.                          gpointer callback_data);
  208.  
  209. /**
  210.  * GnomeVFSAsyncSetFileInfoCallback:
  211.  * @handle: handle of the operation generating the callback
  212.  * @result: %GNOME_VFS_OK if the operation was successful, otherwise a
  213.  * #GnomeVFSResult error code
  214.  * @file_info: if @result is %GNOME_VFS_OK, a #GnomeVFSFileInfo struct containing
  215.  * requested information about the file
  216.  * @callback_data: user data defined when the callback was established
  217.  *
  218.  * Callback for th egnome_vfs_async_set_file_info() function.
  219.  **/
  220. typedef void    (* GnomeVFSAsyncSetFileInfoCallback)    
  221.                         (GnomeVFSAsyncHandle *handle,
  222.                          GnomeVFSResult result,
  223.                          GnomeVFSFileInfo *file_info,
  224.                          gpointer callback_data);
  225.  
  226.  
  227. /**
  228.  * GnomeVFSAsyncDirectoryLoadCallback:
  229.  * @handle: handle of the operation generating the callback
  230.  * @result: %GNOME_VFS_OK if the operation was sucessful, 
  231.  * %GNOME_VFS_ERROR_EOF if the last file in the directory 
  232.  * has been read, otherwise a #GnomeVFSResult error code
  233.  * @list: a #GList of #GnomeVFSFileInfo structs representing 
  234.  * information about the files just loaded
  235.  * @entries_read: number of entries read from @handle for this instance of
  236.  * the callback.
  237.  * @callback_data: user data defined when the callback was established
  238.  *
  239.  * Callback for the gnome_vfs_async_directory_load() function.
  240.  **/
  241. typedef void    (* GnomeVFSAsyncDirectoryLoadCallback)
  242.                         (GnomeVFSAsyncHandle *handle,
  243.                          GnomeVFSResult result,
  244.                          GList *list,
  245.                          guint entries_read,
  246.                          gpointer callback_data);
  247.  
  248. /**
  249.  * GnomeVFSAsyncXferProgressCallback:
  250.  * @handle: handle of the xfer operation generating the callback
  251.  * @info: information on the current progress in the transfer
  252.  * @data: user data defined when the transfer was established
  253.  *
  254.  * Callback for the gnome_vfs_async_xfer() function. Called periodically
  255.  * to update the caller about the status of the transfer (percent complete,
  256.  * phase of the operation, etc). If @info->status is not %GNOME_VFS_XFER_PROGRESS_STATUS_OK
  257.  * then the callback is expected to make a "decision" about some problem / query
  258.  * during the operation. The appropriate #GnomeVFSXferErrorAction or #GnomeVFSOverwriteAction
  259.  * (depending on the particular state of @info->status) should be returned
  260.  * informing the transfer engine how to proceed.
  261.  *
  262.  * Return value: 0 or an item from #GnomeVFSXferErrorAction or #GnomeVFSOverwriteAction
  263.  **/
  264. typedef gint    (* GnomeVFSAsyncXferProgressCallback)
  265.                         (GnomeVFSAsyncHandle *handle,
  266.                          GnomeVFSXferProgressInfo *info,
  267.                          gpointer data);
  268.  
  269. struct _GnomeVFSFindDirectoryResult {
  270.     GnomeVFSURI *uri;
  271.     GnomeVFSResult result;
  272.  
  273.     /* Reserved to avoid future breaks in ABI compatibility */
  274.     void *reserved1;
  275.     void *reserved2;
  276. };
  277.  
  278. typedef struct _GnomeVFSFindDirectoryResult GnomeVFSFindDirectoryResult;
  279.  
  280. GType                        gnome_vfs_find_directory_result_get_type (void);
  281. GnomeVFSFindDirectoryResult* gnome_vfs_find_directory_result_dup      (GnomeVFSFindDirectoryResult* result);
  282. void                         gnome_vfs_find_directory_result_free     (GnomeVFSFindDirectoryResult* result);
  283.  
  284. /**
  285.  * GnomeVFSAsyncFindDirectoryCallback:
  286.  * @handle: handle of the operation generating the callback
  287.  * @results: #GList of #GnomeVFSFindDirectoryResult *s containing
  288.  * special directories matching the find criteria.
  289.  * @data: user data defined when the operation was established
  290.  *
  291.  * Callback for the gnome_vfs_async_find_directory() function.
  292.  **/
  293. typedef void    (* GnomeVFSAsyncFindDirectoryCallback)
  294.                         (GnomeVFSAsyncHandle *handle,
  295.                          GList *results /* GnomeVFSFindDirectoryResult */,
  296.                          gpointer data);
  297.  
  298. typedef void    (* GnomeVFSAsyncFileControlCallback)    (GnomeVFSAsyncHandle *handle,
  299.                              GnomeVFSResult result,
  300.                              gpointer operation_data,
  301.                              gpointer callback_data);
  302.  
  303. void           gnome_vfs_async_cancel                 (GnomeVFSAsyncHandle                   *handle);
  304.  
  305. void           gnome_vfs_async_open                   (GnomeVFSAsyncHandle                  **handle_return,
  306.                                const gchar                           *text_uri,
  307.                                GnomeVFSOpenMode                       open_mode,
  308.                                int                      priority,
  309.                                GnomeVFSAsyncOpenCallback              callback,
  310.                                gpointer                               callback_data);
  311. void           gnome_vfs_async_open_uri               (GnomeVFSAsyncHandle                  **handle_return,
  312.                                GnomeVFSURI                           *uri,
  313.                                GnomeVFSOpenMode                       open_mode,
  314.                                int                      priority,
  315.                                GnomeVFSAsyncOpenCallback              callback,
  316.                                gpointer                               callback_data);
  317.  
  318. #ifndef GNOME_VFS_DISABLE_DEPRECATED
  319. void           gnome_vfs_async_open_as_channel        (GnomeVFSAsyncHandle                  **handle_return,
  320.                                const gchar                           *text_uri,
  321.                                GnomeVFSOpenMode                       open_mode,
  322.                                guint                                  advised_block_size,
  323.                                int                      priority,
  324.                                GnomeVFSAsyncOpenAsChannelCallback     callback,
  325.                                gpointer                               callback_data);
  326. void           gnome_vfs_async_open_uri_as_channel    (GnomeVFSAsyncHandle                  **handle_return,
  327.                                GnomeVFSURI                           *uri,
  328.                                GnomeVFSOpenMode                       open_mode,
  329.                                guint                                  advised_block_size,
  330.                                int                      priority,
  331.                                GnomeVFSAsyncOpenAsChannelCallback     callback,
  332.                                gpointer                               callback_data);
  333. #endif /* GNOME_VFS_DISABLE_DEPRECATED */
  334.  
  335. void           gnome_vfs_async_create                 (GnomeVFSAsyncHandle                  **handle_return,
  336.                                const gchar                           *text_uri,
  337.                                GnomeVFSOpenMode                       open_mode,
  338.                                gboolean                               exclusive,
  339.                                guint                                  perm,
  340.                                int                      priority,
  341.                                GnomeVFSAsyncOpenCallback              callback,
  342.                                gpointer                               callback_data);
  343. void           gnome_vfs_async_create_uri             (GnomeVFSAsyncHandle                  **handle_return,
  344.                                GnomeVFSURI                           *uri,
  345.                                GnomeVFSOpenMode                       open_mode,
  346.                                gboolean                               exclusive,
  347.                                guint                                  perm,
  348.                                int                      priority,
  349.                                GnomeVFSAsyncOpenCallback              callback,
  350.                                gpointer                               callback_data);
  351. void           gnome_vfs_async_create_symbolic_link   (GnomeVFSAsyncHandle                  **handle_return,
  352.                                GnomeVFSURI                           *uri,
  353.                                const gchar                           *uri_reference,
  354.                                int                      priority,
  355.                                GnomeVFSAsyncOpenCallback              callback,
  356.                                gpointer                               callback_data);
  357. #ifndef GNOME_VFS_DISABLE_DEPRECATED
  358. void           gnome_vfs_async_create_as_channel      (GnomeVFSAsyncHandle                  **handle_return,
  359.                                const gchar                           *text_uri,
  360.                                GnomeVFSOpenMode                       open_mode,
  361.                                gboolean                               exclusive,
  362.                                guint                                  perm,
  363.                                int                      priority,
  364.                                GnomeVFSAsyncCreateAsChannelCallback   callback,
  365.                                gpointer                               callback_data);
  366. void           gnome_vfs_async_create_uri_as_channel  (GnomeVFSAsyncHandle                  **handle_return,
  367.                                GnomeVFSURI                           *uri,
  368.                                GnomeVFSOpenMode                       open_mode,
  369.                                gboolean                               exclusive,
  370.                                guint                                  perm,
  371.                                int                      priority,
  372.                                GnomeVFSAsyncCreateAsChannelCallback   callback,
  373.                                gpointer                               callback_data);
  374. #endif /* GNOME_VFS_DISABLE_DEPRECATED */
  375.  
  376. void           gnome_vfs_async_close                  (GnomeVFSAsyncHandle                   *handle,
  377.                                GnomeVFSAsyncCloseCallback             callback,
  378.                                gpointer                               callback_data);
  379. void           gnome_vfs_async_read                   (GnomeVFSAsyncHandle                   *handle,
  380.                                gpointer                               buffer,
  381.                                guint                                  bytes,
  382.                                GnomeVFSAsyncReadCallback              callback,
  383.                                gpointer                               callback_data);
  384. void           gnome_vfs_async_write                  (GnomeVFSAsyncHandle                   *handle,
  385.                                gconstpointer                          buffer,
  386.                                guint                                  bytes,
  387.                                GnomeVFSAsyncWriteCallback             callback,
  388.                                gpointer                               callback_data);
  389. void           gnome_vfs_async_seek                   (GnomeVFSAsyncHandle                   *handle,
  390.                                GnomeVFSSeekPosition                   whence,
  391.                                GnomeVFSFileOffset                     offset,
  392.                                GnomeVFSAsyncSeekCallback              callback,
  393.                                gpointer                               callback_data);
  394. void           gnome_vfs_async_get_file_info          (GnomeVFSAsyncHandle                  **handle_return,
  395.                                GList                                 *uri_list,
  396.                                GnomeVFSFileInfoOptions                options,
  397.                                int                      priority,
  398.                                GnomeVFSAsyncGetFileInfoCallback       callback,
  399.                                gpointer                               callback_data);
  400.  
  401. /* Setting the file info sometimes changes more info than the
  402.  * caller specified; for example, if the name changes the MIME type might
  403.  * change, and if the owner changes the SUID & SGID bits might change. 
  404.  * Therefore the callback returns the new file info for the caller's
  405.  * convenience. The GnomeVFSFileInfoOptions passed here are those used 
  406.  * for the returned file info; they are not used when setting.
  407.  */
  408. void           gnome_vfs_async_set_file_info          (GnomeVFSAsyncHandle                  **handle_return,
  409.                                GnomeVFSURI                           *uri,
  410.                                GnomeVFSFileInfo                      *info,
  411.                                GnomeVFSSetFileInfoMask                mask,
  412.                                GnomeVFSFileInfoOptions                options,
  413.                                int                      priority,
  414.                                GnomeVFSAsyncSetFileInfoCallback       callback,
  415.                                gpointer                               callback_data);
  416. void           gnome_vfs_async_load_directory         (GnomeVFSAsyncHandle                  **handle_return,
  417.                                const gchar                           *text_uri,
  418.                                GnomeVFSFileInfoOptions                options,
  419.                                guint                                  items_per_notification,
  420.                                int                      priority,
  421.                                GnomeVFSAsyncDirectoryLoadCallback     callback,
  422.                                gpointer                               callback_data);
  423. void           gnome_vfs_async_load_directory_uri     (GnomeVFSAsyncHandle                  **handle_return,
  424.                                GnomeVFSURI                           *uri,
  425.                                GnomeVFSFileInfoOptions                options,
  426.                                guint                                  items_per_notification,
  427.                                int                      priority,
  428.                                GnomeVFSAsyncDirectoryLoadCallback     callback,
  429.                                gpointer                               callback_data);
  430. GnomeVFSResult gnome_vfs_async_xfer                   (GnomeVFSAsyncHandle                  **handle_return,
  431.                                GList                                 *source_uri_list,
  432.                                GList                                 *target_uri_list,
  433.                                GnomeVFSXferOptions                    xfer_options,
  434.                                GnomeVFSXferErrorMode                  error_mode,
  435.                                GnomeVFSXferOverwriteMode              overwrite_mode,
  436.                                int                      priority,
  437.                                GnomeVFSAsyncXferProgressCallback      progress_update_callback,
  438.                                gpointer                               update_callback_data,
  439.                                GnomeVFSXferProgressCallback           progress_sync_callback,
  440.                                gpointer                               sync_callback_data);
  441. void           gnome_vfs_async_find_directory         (GnomeVFSAsyncHandle                  **handle_return,
  442.                                GList                                 *near_uri_list,
  443.                                GnomeVFSFindDirectoryKind              kind,
  444.                                gboolean                               create_if_needed,
  445.                                gboolean                               find_if_needed,
  446.                                guint                                  permissions,
  447.                                int                      priority,
  448.                                GnomeVFSAsyncFindDirectoryCallback     callback,
  449.                                gpointer                               user_data);
  450.  
  451. void           gnome_vfs_async_file_control           (GnomeVFSAsyncHandle                   *handle,
  452.                                const char                            *operation,
  453.                                gpointer                               operation_data,
  454.                                GDestroyNotify                         operation_data_destroy_func,
  455.                                GnomeVFSAsyncFileControlCallback       callback,
  456.                                gpointer                               callback_data);
  457.  
  458. G_END_DECLS
  459.  
  460. #endif /* GNOME_VFS_ASYNC_OPS_H */
  461.